<?php 
$cs=Yii::app()->clientScript;
$cs->registerScript('truck_appointment_dialog_view',<<<END
$(document).bind('keydown',function(e){if(e.keyCode==27){parent.$.modal.close();}});
$("a[href=#]").click(function(){
	if($(this).attr('front_fuel')==''){alert('车牌号:'+$(this).text()+' 标准油耗不存在!');return false;}
	\$parent=$(window.parent.document);
	\$parent.find("#Confirm_sheet_truck_plate_no").val($(this).text()).removeClass('error').next('span').remove();
	\$parent.find("#Confirm_sheet_fk_truck_id").val($(this).attr('class'));
	\$parent.find("#Confirm_sheet_driver1_name").val($(this).attr('driver_name')).removeClass('error').next('span').remove();
	\$parent.find("#Confirm_sheet_driver1_mobile").val($(this).attr('driver_mobile')).removeClass('error').next('span').remove();
	\$parent.find("#Confirm_sheet_front_fuel").val($(this).attr('front_fuel')).removeClass('error').next('span').remove();
	\$parent.find("#Confirm_sheet_empty_fuel").val($(this).attr('empty_fuel')).removeClass('error').next('span').remove();
	\$parent.find("#Confirm_sheet_light_fuel").val($(this).attr('light_fuel')).removeClass('error').next('span').remove();
	\$parent.find("#Confirm_sheet_heavy_fuel").val($(this).attr('heavy_fuel')).removeClass('error').next('span').remove();
	\$parent.find("#Confirm_sheet_actual_front_fuel").val($(this).attr('front_fuel')).removeClass('error').next('span').remove();
	\$parent.find("#Confirm_sheet_actual_empty_fuel").val($(this).attr('empty_fuel')).removeClass('error').next('span').remove();
	\$parent.find("#Confirm_sheet_actual_light_fuel").val($(this).attr('light_fuel')).removeClass('error').next('span').remove();
	\$parent.find("#Confirm_sheet_actual_heavy_fuel").val($(this).attr('heavy_fuel')).removeClass('error').next('span').remove();
	\$parent.find("#truck_type").val($(this).attr('truck_type'));
	\$parent.find("#truck_type_ratio").val($(this).attr('truck_type_ratio'));
	if($(this).attr('board_plate_no')!=''){//如果主车有默认尾板,将默认尾板编号、车型、计算比率写入页面
		\$parent.find("#Confirm_sheet_board_plate_no").val($(this).attr('board_plate_no')).removeClass('error').next('span').remove();
		\$parent.find("#Confirm_sheet_type").val($(this).attr('board_type')).removeClass('error').next('span').remove();
		\$parent.find("#Confirm_sheet_compute_ratio").val($(this).attr('board_compute_ratio')).removeClass('error').next('span').remove();
	}
	if(\$parent.find("#Confirm_sheet_board_plate_no").val()==''){//如果页面没有输入尾板编号，将车头车型、计算比率写入页面
		\$parent.find("#Confirm_sheet_type").val($(this).attr('truck_type')).removeClass('error').next('span').remove();
		\$parent.find("#Confirm_sheet_compute_ratio").val($(this).attr('truck_type_ratio')).removeClass('error').next('span').remove();
	}
	parent.$.modal.close();
	return false;
});
END
)
?>
<?php echo CHtml::beginForm(array($this->action->id));?>
<div style="padding-bottom:10px">
	车牌号：<input type="text" name="keys[trucks.plate_no]" size="7" value="<?php echo isset($_GET['keys']['trucks.plate_no'])?$_GET['keys']['trucks.plate_no']:'';?>"/>&nbsp;&nbsp;
	模糊查询：<input type="radio" name="keys[blur]" value="1" checked/>是  
	<input type="radio" name="keys[blur]" value="0" <?php echo isset($_GET['keys']['blur'])&&$_GET['keys']['blur']==0?'checked':'';?>/>否&nbsp;&nbsp;
	<input type="hidden" name="app_time" value="<?php echo $_GET['app_time']?>"/>
	<input type="submit" value="搜索"/>
</div>
<?php echo CHtml::endForm();?>
<table class="dataGrid" width=80%>
  <tbody>
  	<tr>
<?php foreach($models as $n=>$model): ?>
	<?php if($n>1&&$n%4==0) echo '</tr><tr>';?>
    <td><?php echo CHtml::link($model->plate_no,'#',
    array('class'=>$model->id,'driver_name'=>$model->major_driver_name,'driver_mobile'=>$model->manufacturer,
    'front_fuel'=>$model->front_fuel,'empty_fuel'=>$model->empty_fuel,'light_fuel'=>$model->light_fuel,'heavy_fuel'=>$model->heavy_fuel,
    'truck_type'=>$model->type,'truck_type_ratio'=>$model->compute_ratio*100,
    'board_plate_no'=>$model->board_plate_no,
   	'board_type'=>$model->board_type,
    'board_compute_ratio'=>$model->board_compute_ratio*100
   	)); ?></td>
<?php endforeach; ?>
	</tr>
  </tbody>
</table>
<br/>
<?php $this->widget('CLinkPager',array('pages'=>$pages,'maxButtonCount'=>Yii::app()->params['dialog'][$this->action->id]['maxButtonCount'])); ?>